package com.fenghongzhang.kotlin5

import android.app.Application
import android.content.Context
import com.fenghongzhang.kotlin5.day04.LogUtil
import com.orhanobut.logger.*


class App : Application(){

    companion object{
       lateinit var context:Context
    }

    override fun onCreate() {
        super.onCreate()
        LogUtil.level = LogUtil.INFO

        context = applicationContext

        val formatStrategy: FormatStrategy = PrettyFormatStrategy.newBuilder()
            .showThreadInfo(false) // (Optional) Whether to show thread info or not. Default true
            .methodCount(0) // (Optional) How many method line to show. Default 2
            .methodOffset(7) // (Optional) Hides internal method calls up to offset. Default 5
//            .logStrategy(customLog) // (Optional) Changes the log strategy to print out. Default LogCat
            .tag("My custom tag") // (Optional) Global tag for every log. Default PRETTY_LOGGER
            .build()

        Logger.addLogAdapter(AndroidLogAdapter(formatStrategy))
        Logger.addLogAdapter(DiskLogAdapter())
    }
}